<template>
  <ele-modal
    form
    :width="1400"
    :model-value="modelValue"
    title="选择出单车辆"
    @update:modelValue="updateModelValue"
  >
    <vehicle action="choose" @done="chooseDone" />
  </ele-modal>
</template>

<script setup>
  import { watch } from 'vue';
  import Vehicle from '@/views/vehicle/index.vue';
  const emit = defineEmits(['done', 'update:modelValue']);

  const props = defineProps({
    /** 弹窗是否打开 */
    modelValue: Boolean
  });

  /** 选择完成 */
  const chooseDone = (e) => {
    emit('done', e);
  };

  /** 更新modelValue */
  const updateModelValue = (value) => {
    emit('update:modelValue', value);
  };
  watch(
    () => props.modelValue,
    (modelValue) => {
      if (modelValue) {
        console.log('打开了');
      } else {
        console.log('关闭');
      }
    }
  );
</script>
